package cvo.pro4.chess.client;

import java.util.List;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.RootPanel;

import cvo.pro4.chess.client.dto.PieceDto;
import cvo.pro4.chess.client.entities.Player;
import cvo.pro4.chess.client.exceptions.IllegalCoordinatesException;
import cvo.pro4.chess.client.pocDragDrop.Basic2Widget;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class chessgame implements EntryPoint {
  /**
   * The message displayed to the user when the server cannot be reached or
   * returns an error.
   */
  private static final String SERVER_ERROR = "An error occurred while "
      + "attempting to contact the server. Please check your network "
      + "connection and try again.";

  private GameFacade gameFacade;
  private Button a = new Button("test");
  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
	  
	  gameFacade = GameFacade.getGameFacade();
	  try {
		//Create a player
		Player playerOne = new Player(01, "Jerry the rook", 5, 2500);
		gameFacade.startGame(playerOne);
		List <String> tiles = gameFacade.getBoard().getTiles();
		List <PieceDto> pieces = gameFacade.getBoard().getPieces();
		
		
		// Jo die tiles zijn u allemaal String voorstellingen x;y;B of x;y;W
		// pieces hebben pieceDto's met alle essentiele info color,type,id en position
		
		Grid grid = new Grid(8,8);
		
		
		
		//TODO
	} catch (IllegalCoordinatesException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	  
	  /*
	   * toevoegen van widget voor het ophalen van de piece
	   */
	  Basic2Widget bw1 = new Basic2Widget("get the piece", "Enter the coordinations of the startfield of your choice");
	  RootPanel.get().add(bw1);
	  
	  /*
	   * toevoegen van widget voor het moven van de piece
	   */
	  Basic2Widget bw2 = new Basic2Widget("move the piece", "Enter the destination coordinates you want your piece to move to");
	  RootPanel.get().add(bw2);
	 
  }
}
